
#pragma once

static INLINE void test_reader( AllocContext * ac )
{
    FILE *          fin;
    const char *    src_file = "c:/TEMP/lst.txt";

    fin = fopen( src_file, "rb" );
    if( fin )
    {
        ReaderContext * reader = create_reader( ac, fin, src_file );

        //set_default_namespace( reader, alloc_id( ac, "System", 0 ) );

        for( ;; )
        {
            Obj * e = read_obj( reader );
            if( e )
            {
                fputs( "--> ", stdout );
                print_obj( e, stdout );
                fputc( '\n', stdout );
            }
            else
            {
                fputs( "--\n", stdout );
                break;
            }
        }

        free_reader( reader );
    }
    else
    {
        printf( "can't open %s\n", src_file );
        return;
    }

    fclose( fin );
}
